﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Basmus.ReadWrite;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace Basmus.Tests.ReadWrite
{
    [TestClass]
    public class StringReaderWriterTest
    {
        [TestMethod]
        public void ReadTest()
        {
            var target = new StringReaderWriter();

            var strings = new[] {string.Empty, null, "teststring"};
            var expected = strings.Select(ReadResult<string>.Success).ToArray();

            var actual = strings.Select(target.Read).ToArray();

            CollectionAssert.AreEqual(expected, actual);

        }

        [TestMethod]
        public void WriteTest()
        {
            var target = new StringReaderWriter();

            var expected = new[] { string.Empty, null, "teststring" };
            var actual = expected.Select(target.Write).ToArray();


            CollectionAssert.AreEqual(expected, actual);
        }
    }
}
